using System;

namespace Reflector.CodeDom
{
    public class CodeDomLanguagePackage : IPackage
    {
        // Fields
        private CodeDomLanguage language;
        private ILanguageManager languageManager;

        // Methods

        #region IPackage Members

        /// <summary>
        /// Loads the specified service provider.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        public void Load(IServiceProvider serviceProvider)
        {
            language = new CodeDomLanguage();
            languageManager = (ILanguageManager) 
                serviceProvider.GetService(typeof (ILanguageManager));
            languageManager.RegisterLanguage(language);
        }

        /// <summary>
        /// Unloads this instance.
        /// </summary>
        public void Unload()
        {
            languageManager.UnregisterLanguage(language);
        }

        #endregion
    }
}